package juc.c_000;/*
   Talk is cheap. Show me the code.
 */

/**
 * @Description
 * @Date 2021/6/6
 * @Author liudl
 */
public class T04_ThreadState {
    static class MyThread extends Thread {
        @Override
        public void run() {
            System.out.println(this.getState());
            for (int i = 0; i < 10; i++) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(i);
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        MyThread myThread = new MyThread();
        System.out.println(myThread.getState());
        myThread.start();
        Thread.sleep(5100);
        System.out.println(myThread.getState());
    }
}
